package leetcode.code1742;

public class Solution {
	public int countBalls(int lowLimit, int highLimit) {
		int[] h = new int[46];
		int ans = 0;
		for (int i = lowLimit, cur = 0, tmp = 0; i <= highLimit; i++) {
			cur = 0;
			tmp = i;
			while (tmp > 0) {
				cur += tmp % 10;
				tmp /= 10;
			}
			ans = Math.max(ans, ++h[cur]);
		}
		return ans;
	}
}
